<template>
	<view>
		<swiper class="swiper" :autoplay="autoplay" :interval="interval" :indicator-dots='indicatorDots'>
			<swiper-item v-for="(item,index) in bannerList" @click="goToCompany(item.id)">
				<image :src="item.src" mode="" class="swiper-image"></image>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				autoplay: true, //自动滚动
				interval: 3000, //切换时间间隔
				indicatorDots: true,
			};
		},
		props: {
			bannerList: {
				type: [Array, Object],
				default: function() {
					return [{
						'id': 1,
						'src': '/static/imgs/zz.jpg'
					}]
				}
			}
		},
		methods: {
			//去公司页面
			goToCompany(company_id) {
				console.log('company_id:', company_id);
				let url = '/pages/company/detail/detail?id=' + company_id;
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style>
	.swiper-image {
		width: 100%;
		height: 100%;
	}
</style>
